package com.d2rv.offscreen;

import com.d2rv.guide.GoalManager;
import com.d2rv.model.CityModelManager;
import com.d2rv.skybox.SkyboxManager;
import com.d2rv.user.UserManager;
import processing.core.PApplet;

/**
 * This class is the manager of the offscreen stereo mode.
 *
 * @author Darrieutort A., Dupouy A., Rossignol L., Van Poucke A.
 */
public class StereoModeManager {

    private AnaglypheManager anaglyphemanager;
    private SideBySideManager sidebysidemanager;

    /**
     * Default constructor.
     *
     * @param parent the current application
     * @param usermanager the manager of the user
     * @param citymodelmanager the manager of the city model
     * @param skyboxmanager the manager of the skybox
     * @param goalmanager the manager of the goal
     */
    public StereoModeManager(PApplet parent, UserManager usermanager, CityModelManager citymodelmanager, SkyboxManager skyboxmanager, GoalManager goalmanager) {
        this.anaglyphemanager = new AnaglypheManager(parent, usermanager, citymodelmanager, skyboxmanager, goalmanager);
        this.sidebysidemanager = new SideBySideManager(parent, usermanager, citymodelmanager, skyboxmanager, goalmanager);
    }

    /**
     * Calls the draw method of the anaglyphe or side by side manager.
     * @param mode
     */
    public void draw(int mode) {
        if (mode == 1) {
            this.anaglyphemanager.draw();
        } else {
            this.sidebysidemanager.draw();
        }
    }

    /**
     *
     * Calls the show method the offscreen anaglyphe and side by side
     * 
     * @param parent the current application
     * @param x the x coordinate of the left corner of the offscreen
     * @param y the y coordinate of the left corner of the offscreen
     * @param mode different mode between stereo et mono
     */
    public void show(PApplet parent, int x, int y, int mode) {
        if (mode == 1) {
            this.anaglyphemanager.show(parent, x, y);
        } else {
            this.sidebysidemanager.show(parent, x, y);
        }
    }
    
    /**
     * Returns the anaglyphe manager
     * @return the anaglyphe manager
     */
    public AnaglypheManager anaglyphemanager() {
        return this.anaglyphemanager;
    }
    
    /**
     * Returns the side by side manager
     * @return the side by side manager
     */
    public SideBySideManager sidebysidemanager() {
        return this.sidebysidemanager;
    }
}